Optimal. Leaf size=92 \[ \frac {i a (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n}}{f (1+n)}+\frac {2 i a^2 (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n}}{f n (1+n)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 92, normalized size of antiderivative = 1.00, number of steps
used = 2, number of rules used = 2, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.062, Rules used = {3575, 3574}
\begin {gather*} \frac {2 i a^2 (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n}}{f n (n+1)}+\frac {i a (a+i a \tan (e+f x))^{1-n} (d \sec (e+f x))^{2 n}}{f (n+1)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3574
Rule 3575
Rubi steps
\begin {align*} \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx &=\frac {i a (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n}}{f (1+n)}+\frac {(2 a) \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n} \, dx}{1+n}\\ &=\frac {i a (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n}}{f (1+n)}+\frac {2 i a^2 (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n}}{f n (1+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.20, size = 61, normalized size = 0.66 \begin {gather*} -\frac {a^2 (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n} (-i (2+n)+n \tan (e+f x))}{f n (1+n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.72, size = 0, normalized size = 0.00 \[\int \left (d \sec \left (f x +e \right )\right )^{2 n} \left (a +i a \tan \left (f x +e \right )\right )^{2-n}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Both result and optimal contain complex but leaf count of result is larger than
twice the leaf count of optimal. 319 vs. \(2 (88) = 176\).
time = 0.61, size = 319, normalized size = 3.47 \begin {gather*} \frac {2^{n + 1} a^{2} d^{2 \, n} \cos \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) - i \cdot 2^{n + 1} a^{2} d^{2 \, n} \sin \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) + 2 \, {\left (a^{2} d^{2 \, n} n + a^{2} d^{2 \, n}\right )} 2^{n} \cos \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) + 2 \, {\left (-i \, a^{2} d^{2 \, n} n - i \, a^{2} d^{2 \, n}\right )} 2^{n} \sin \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right )}{{\left (-i \, a^{n} n^{2} - i \, a^{n} n + {\left (-i \, a^{n} n^{2} - i \, a^{n} n\right )} \cos \left (2 \, f x + 2 \, e\right ) + {\left (a^{n} n^{2} + a^{n} n\right )} \sin \left (2 \, f x + 2 \, e\right )\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.44, size = 150, normalized size = 1.63 \begin {gather*} \frac {{\left ({\left (i \, n + i\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (i \, n + 2 i\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i\right )} \left (\frac {2 \, d e^{\left (i \, f x + i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{2 \, n} e^{\left ({\left (-i \, f n + 2 i \, f\right )} x - 4 i \, f x + {\left (-i \, n + 2 i\right )} e - {\left (n - 2\right )} \log \left (\frac {2 \, d e^{\left (i \, f x + i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right ) - {\left (n - 2\right )} \log \left (\frac {a}{d}\right ) - 4 i \, e\right )}}{2 \, {\left (f n^{2} + f n\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (d \sec {\left (e + f x \right )}\right )^{2 n} \left (i a \left (\tan {\left (e + f x \right )} - i\right )\right )^{2 - n}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 7.82, size = 260, normalized size = 2.83 \begin {gather*} -{\mathrm {e}}^{-e\,4{}\mathrm {i}-f\,x\,4{}\mathrm {i}}\,{\left (\frac {d}{\frac {{\mathrm {e}}^{-e\,1{}\mathrm {i}-f\,x\,1{}\mathrm {i}}}{2}+\frac {{\mathrm {e}}^{e\,1{}\mathrm {i}+f\,x\,1{}\mathrm {i}}}{2}}\right )}^{2\,n}\,\left (\frac {{\left (a-\frac {a\,\left ({\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}\right )\,1{}\mathrm {i}}{{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}+1}\right )}^{2-n}}{2\,f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}+\frac {{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,{\left (a-\frac {a\,\left ({\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}\right )\,1{}\mathrm {i}}{{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}+1}\right )}^{2-n}\,\left (n+2\right )}{2\,f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}+\frac {{\mathrm {e}}^{e\,4{}\mathrm {i}+f\,x\,4{}\mathrm {i}}\,{\left (a-\frac {a\,\left ({\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}\right )\,1{}\mathrm {i}}{{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}+1}\right )}^{2-n}\,\left (n+1\right )}{2\,f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________